const baseUrl = 'http://localhost:3300'   
const request = (url = '', data, type, header) => {
	console.log(baseUrl + url)
    return new Promise((resolve, reject) => {
        uni.request({
            method: type ? type : 'get',
            url: baseUrl + url,
            data: data ? data : {},
            header: header ? header : {},
            dataType: 'json',         
        }).then((response) => {
            setTimeout(function() {
                uni.hideLoading();
            }, 200);
            let {data} = response;		
            resolve(data);
        }).catch(error => {
            reject(error)
        })
    });
}
export default request